package com.neu.cpsp.controller;/*
    @author neu.xiangwenjuan
    @create 2022/4/26
*/

import com.neu.cpsp.service.DepartmentService;
import com.neu.cpsp.util.result.Result;
import com.neu.cpsp.util.result.ResultGenerator;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

//import javax.xml.ws.Action;

@CrossOrigin
@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    @ApiOperation("得到部门列表")
    @RequestMapping(value = "selectAllDepartment",method = RequestMethod.GET)
    @ResponseBody
    private Result selectAllDepartment() {
        return ResultGenerator.genSuccessResult(departmentService.selectAll());
    }

    @ApiOperation("根据部门id得到班组列表")
    @RequestMapping(value = "getTeamByDepart",method = RequestMethod.GET)
    @ResponseBody
    private Result getTeamByDepart(String departmentId) {
        return ResultGenerator.genSuccessResult(departmentService.findTeamGroupByDepart(departmentId));
    }
}
